/*****************************************************************************
* Copyright (c) 2014,H.B.
* All rights reserved.
* 
* FileName : DtvSignal.java
* Description : define DtvSignal
* 
* Version : 0.0.0
* Author : HB   Reviewer : 
* Date : 2014-07-07
* Record : Create
*
* History : 
* (1) Version : 0.0.0
*     Author : HB   Reviewer : 
*     Date : 2014-07-07
*     Record : Create
****************************************************************************/

package hb.dtv;



public class DtvSignal
{
	final int mJniPtr;

	DtvSignal(int ptr)
	{
		mJniPtr=ptr;
	}

	public void Release()
	{
		nativeRelease(mJniPtr);
	}
	
	public boolean Wait(int timoutMs)
	{
		return nativeWait(mJniPtr,timoutMs);
	}
	
	public void Abort()
	{
		nativeAbort(mJniPtr);
	}

	@Override
	public boolean equals(Object o) 
	{
		 if (this == o) return true;
		 if (!(o instanceof DtvSignal)) return false;
		 DtvSignal d=(DtvSignal)o;
		 return mJniPtr==d.mJniPtr;
	}

	@Override
	protected void finalize() throws Throwable 
	{
		nativeDestroy(mJniPtr);
		super.finalize();
	}
	
	private native static boolean nativeWait(int jniPtr,int timoutMs);
	
	private native static void nativeAbort(int jniPtr);
		
	private native static void nativeRelease(int jniPtr);

	private native static void nativeDestroy(int jniPtr);
}

